Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak(natives/player): document that the recharge multiplier gets reset on player ped change #1156

Merged

Conversation

AvarianKnight
Copy link
Collaborator

No description provided.

Copy link
Contributor

@colistro123 colistro123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I haven't tested this, but it seems that calling NETWORK_RESURRECT_LOCAL_PLAYER might also reset this variable, especially if bLeaveDeadPed is passed as true.

I know it might be obvious, but respawning/dying could also cause this to reset (since it calls the resurrectPlayerMethod called by the native) when called from one of the game skeleton update functions such as CGameLogic::Update.

Copy link
Contributor

@JayPaulinCodes JayPaulinCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dittoing the comments by @colistro123 above regarding other than that 1 resurrect native that may be useful to add, otherwise all LGTM!

@AvarianKnight
Copy link
Collaborator Author

I can't replicate this behavior.

CreateThread(function()
    SetEntityHealth(PlayerPedId(), 0)
    Wait(2000)
    local pos = GetEntityCoords(PlayerPedId())
    NetworkResurrectLocalPlayer(pos, 120.0, 0, true)
end)

then running /crun SetPlayerHealthRechargeMultiplier(PlayerId(), 0.0), after being resurrected they still have the multiplier of 0.0

It should probably also be noted this doesn't seem to actually have a max value of 1.0 as it might imply from de-compiled scripts

Setting this to SetPlayerHealthRechargeMultiplier(PlayerId(), 10.0) works, and speeds up health regen by a lot, though I'm not sure why you would ever do this, it should probably be documented.

@colistro123
Copy link
Contributor

I can't replicate this behavior.

CreateThread(function()
    SetEntityHealth(PlayerPedId(), 0)
    Wait(2000)
    local pos = GetEntityCoords(PlayerPedId())
    NetworkResurrectLocalPlayer(pos, 120.0, 0, true)
end)

then running /crun SetPlayerHealthRechargeMultiplier(PlayerId(), 0.0), after being resurrected they still have the multiplier of 0.0

It should probably also be noted this doesn't seem to actually have a max value of 1.0 as it might imply from de-compiled scripts

Setting this to SetPlayerHealthRechargeMultiplier(PlayerId(), 10.0) works, and speeds up health regen by a lot, though I'm not sure why you would ever do this, it should probably be documented.

From looking at the native it seems that there doesn't seem to be any range limiting checks/clamping for how much you can set the multiplier to.

image

Couldn't replicate on my end either, I'm puzzled.

@AvarianKnight AvarianKnight merged commit c3b80a5 into citizenfx:master Aug 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants